/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package GUIalmacen;


import GUI.Procesamiento.GUIVisualizacion;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.io.File;
import java.io.IOException;

import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;

/**
 *
 * @author manuel
 */
public class JPanelMapa extends JPanel implements KeyListener{
    
   VentanaPrincipal vp;
    


    public JPanelMapa(VentanaPrincipal vp) {
        super();
        this.vp=vp;
       
       

    }

    @Override
    public void paint(Graphics g){

int ancho=vp.getObjJuego().getObjMundo().getMialmacen().getAncho();
int alto =vp.getObjJuego().getObjMundo().getMialmacen().getAltura();
         Graphics2D g2 = (Graphics2D)g;

        g=vp.getNuevo().getGraphics();
        for(int i=0;i<ancho;i++)
            for(int j=0;j< alto;j++){
                switch(vp.getObjJuego().getObjMundo().getMialmacen().getArregloCeldas()[j][i].getCelda()){
                    case 'X':
                        g.drawImage(vp.getPared(),i*32,j*32,null);
                        break;

                         case 'D':
                        g.drawImage(vp.getRuta(),i*32,j*32,null);
                        break;

                         case 'P':
                        g.drawImage(vp.getPallet(),i*32,j*32,null);
                        break;
                    default:
                        g.drawImage(vp.getCamino(),i*32,j*32,null);
                        break;
                }
               
            }
//       
       
                g2.drawImage(vp.getNuevo(),0,0,null);
                

        }

    public void keyTyped(KeyEvent ke) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public void keyPressed(KeyEvent ke) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public void keyReleased(KeyEvent ke) {
        throw new UnsupportedOperationException("Not supported yet.");
    }
    }


